<?php 
require_once '../include.php';
 checkLogined();
$rows=getAllCate();
if(!$rows){
	alertMes("没有相应分类，请先添加分类!!", "addCate.php");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>add project</title>
 <link rel="stylesheet" href="styles/backstage.css">
<link href="./styles/global.css"  rel="stylesheet"  type="text/css" media="all" />

<script type="text/javascript" src="./scripts/jquery-1.6.4.js"></script>
<script>

        $(document).ready(function(){
        	/*$("#selectFileBtn").click(function(){
        		$fileField = $('<input type="file" name="thumbs[]"/>');
        		$fileField.hide();
        		$("#attachList").append($fileField);
        		$fileField.trigger("click");
        		$fileField.change(function(){
        		$path = $(this).val();
        		$filename = $path.substring($path.lastIndexOf("\\")+1);
        		$attachItem = $('<div class="attachItem"><div class="left">a.gif</div><div class="right"><a href="#" title="删除附件">删除</a></div></div>');
        		$attachItem.find(".left").html($filename);
        		$("#attachList").append($attachItem);		
        		});
        	});
        	$("#attachList>.attachItem").find('a').live('click',function(obj,i){
        		$(this).parents('.attachItem').prev('input').remove();
        		$(this).parents('.attachItem').remove();
        	});*/


        	$("#selectFileBtn").click(function(){
        		$fileField = $('<input type="file" name="thumbs[]"/>');
        		$fileField.hide();
        		$("#attachList").append($fileField);
        		$fileField.trigger("click");
        		$fileField.change(function(){
	        		$path = $(this).val();
	        		$filename = $path.substring($path.lastIndexOf("\\")+1);
	        		$attachItem = $('<div name="bPic" class="attachItem"><div class="left">a.gif</div><div class="right"><a href="#" title="删除附件">删除</a></div></div>');
	        		$attachItem.find(".left").html($filename);
	        		$("#attachList").append($attachItem);		
        		});
        	});
        	$("#attachList>.attachItem").find('a').live('click',function(obj,i){
        		$(this).parents('.attachItem').prev('input').remove();
        		$(this).parents('.attachItem').remove();
        	});
        });
</script>
</head>
<body>
<br/>
<h3>添加项目</h3>
<br/>
<form action="doAdminAction.php?act=addPro" method="post" enctype="multipart/form-data">
<table class="table" cellpadding="5" cellspacing="0" >
	<tr>
		<th align="right">项目名称</th>
		<td><input type="text" name="pName" class="search" placeholder="请输入项目名称"/></td>
	</tr>
	<tr>
		<th align="right">项目分类</th>
		<td>
		<select name="cId" class="bui_select select">
			<?php foreach($rows as $row):?>
				<option value="<?php echo $row['id'];?>"><?php echo $row['cName'];?></option>
			<?php endforeach;?>
		</select>
		</td>
	</tr>
	<tr>
		<th align="right">项目面积</th>
		<td><input type="text" name="pArea" class="search" placeholder="请输入项目面积"/></td>
	</tr>
	<tr>
		<th align="right">项目介绍</th>
		<td>
			<textarea style="background-color: #E8E8E8;width:700px;height:100px;" name="pDesc" id="pDesc" placeholder="请输入项目介绍"></textarea>
		</td>
	</tr>
	<tr>
		<th align="right">委托单位</th>
		<td><input type="text" name="cUnit" class="search"  placeholder="请输入委托单位"/></td>
	</tr>
	<tr>
		<th align="right">设计内容</th>
		<td>
			<textarea style="background-color: #E8E8E8;width:700px;height:100px;" name="dDesc" id="dDesc" placeholder="请输入设计内容"></textarea>
		</td>
	</tr>
	<tr>
		<th align="right">设计时间</th>
		<td><input type="dTime" name="dTime" class="search" placeholder="请输入设计时间"/></td>
		
	</tr>
	<tr>
		<th align="right">项目图像</th>
		<td>
			<a href="javascript:void(0)" id="selectFileBtn" class="btn">添加图像</a>
			
			<div id="attachList" class="attachList" class="clear"></div>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" class="btn"  value="发布项目"/></td>
	</tr>
</table>
</form>
</body>
</html>